Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

is-descriptor

Package Overview
Dependencies
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-descriptor

Returns true if a value has the characteristics of a valid JavaScript descriptor. Works for data descriptors and accessor descriptors.

  • 1.0.3
  • v1-backport
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
24M
decreased by-47.47%
Maintainers
2
Weekly downloads
 
Created

What is is-descriptor?

The is-descriptor npm package is used for checking if an object is a valid descriptor. Descriptors are objects that define the behavior of properties on JavaScript objects, such as whether they are writable, enumerable, or configurable, and they can also specify getter and setter functions. This package is useful for validation in libraries that manipulate object properties and descriptors, ensuring that operations like defining new properties or modifying existing ones are performed with valid descriptor objects.

What are is-descriptor's main functionalities?

Checking property descriptors

This feature allows you to check if a given object is a valid property descriptor. The code sample demonstrates checking various objects to see if they qualify as descriptors based on their properties.

const isDescriptor = require('is-descriptor');

console.log(isDescriptor({enumerable: false, configurable: true})); // true
console.log(isDescriptor({value: 'hello'})); // true
console.log(isDescriptor({get: function() {}})); // true
console.log(isDescriptor({set: undefined})); // false

Other packages similar to is-descriptor

Keywords

FAQs

Package last updated on 27 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc